<template>
	<view class="form-gather-page">
		<view class="top_nav">
			<view :class="topNavActiveIndex==index?'top_nav_active':''" v-for="(item,index) in topNavList" :key='index' @click="topNavCk(index)">
				{{ item }}
			</view>
		</view>
		<view class="" v-if="actList.length!=0">
			<scroll-view scroll-y="true" :style="'height:'+height+'px'" scroll-with-animation  @scrolltolower="LoadingMore">
				<view class="act-content" v-for="(item,index) in actList" :key='index'>
					<view class="act-content-detail">
						<image v-if="item.image.length!=0" :src="item.image[0].image" mode="aspectFill"></image>
						<view :class="item.active_status == 1?'underway':''" v-if="item.active_status == 1 && item.operate_status == 1">进行中</view>
						<view :class="item.active_status == 2 && item.operate_status == 1?'finished':''" v-else-if="item.active_status == 2 && item.operate_status == 1">已结束</view>
						<view :class="item.operate_status == 0?'unpublished':''" v-else-if="item.operate_status == 0">未发布</view>
						<view class="unbegin" v-else>未开始</view>
						<view class="activity-collection-code" v-if="item.active_type == 'qrcode'">
							活动收款码
						</view>
						<view class="activity-collection-code" v-if="item.group_purchase != 0 && item.active_type != 'qrcode'">
							拼团
						</view>
						<view class="activity-collection-code" v-if="item.group_purchase == 0 && item.active_type != 'qrcode'">
							特惠
						</view>
					</view>
					<view class="act-title-details">
						{{item.name}}
					</view>
					<view class="act-title-content">
						<view class="act-title-detail" v-if="item.customer.length!=0">
							<text>创建者：</text>
							<image :src="item.customer[0].avatar" mode=""></image>
							<text class="act-name">{{item.customer[0].nickname}}</text>
						</view>
						<view class="share-patriarch" v-if="item.active_status == 1 && item.operate_status == 1 && item.active_type != 'qrcode'" @click="shareClick(item)">
							分享给家长
						</view>
						<view class="code-share-patriarch code-share-patriarch2" v-if="item.active_status == 1 && item.operate_status == 1 && item.active_type == 'qrcode'" @click="baoming_codeClick(item)">
							报名信息收集码
						</view>
						<view class="code-share-patriarch" v-if="item.active_status == 1 && item.operate_status == 1 && item.active_type == 'qrcode'" @click="codeClick(item)">
							个人专属收款码
						</view>
					</view>
					<!-- operate_status 操作状态:0暂存,1发布
					 active_status 活动状态:0未开始,1进行中,2已结束
					 -->
					 <!-- 发布 进行中 -->
					<view class="act-operate" 
						v-if="(item.active_status == 1 && item.operate_status == 1 && item.active_type != 'qrcode')"
					>
						<view 
							class="" 
							v-for="(operate,num) in underwayList" 
							:key='num' 
							@click="operateClick(num,item)"
						>
							{{operate}}
						</view>
					</view>
					<view class="code-act-operate"
						v-if="(item.active_status == 1 && item.operate_status == 1 && item.active_type == 'qrcode')"
					>
						<view 
							class="" 
							v-for="(operate,num) in codeUnderwayList" 
							:key='num' 
							@click="codeOperateClick(num,item)"
						>
							{{operate}}
						</view>
					</view>
					<!-- 暂存 -->
					<view 
						class="act-operate" 
						v-else-if='item.operate_status == 0'
					>
						<view v-for="(operate,num) in unpublishedList" :key='num' @click="unpublishedClick(num,item)">
							{{operate}}
						</view>
					</view>
					<!-- 发布 已结束 -->
					<view class="act-operate" v-else-if='item.active_status == 2 && item.operate_status == 1 && item.active_type != "qrcode"'>
						<view v-for="(operate,num) in finish" :key='num' @click="finishClick(num,item)">
							{{operate}}
						</view>
					</view>
					<view class="act-operate" v-else-if='item.active_status == 2 && item.operate_status == 1 && item.active_type == "qrcode"'>
						<view v-for="(operate,num) in finish" :key='num' @click="codeFinishClick(num,item)">
							{{operate}}
						</view>
					</view>
					<view class="order-detail" v-else @click="unbeginClick(item)">
						编辑活动
					</view>
					<view class="order-detail" v-if="item.active_status == 2 && item.operate_status == 1" @click="checkMsg(item)">
						订单详情
					</view>
				</view>
			</scroll-view>
		</view>
		<view class="no-act" v-else>
			暂无活动！请添加活动
		</view>
		<!-- 分享提示 -->
		<uni-popup ref="shareTip" :custom="true">
			<view class="popup_box_de_share">
				<image class="popup_box_close_share" :src="imglink + 'share_tip.png'"></image>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	//#ifdef H5	
	import wx from '@/common/wx-js-sdk.js'
	//#endif
	import uniPopup from '@/components/uni-popup/uni-popup.vue'
	export default{
		filters: {
			goodName(value) {
				if (!value) return ''
				if (value.length > 15) {
					return value.slice(0, 15) + '...'
				}
				return value
			}
		},
		components:{uniPopup},
		data(){
			return{
				imglink: this.$store.state.imgLink,
				topNavList: ['全部','进行中','未发布','已结束'],
				topNavActiveIndex:0,
				underwayList:['编辑活动','邀请员工','活动业绩','订单详情','活动优惠券','结束活动'],
				codeUnderwayList:['编辑活动','邀请员工','活动业绩','订单详情','结束活动'],
				unpublishedList:['编辑活动','邀请员工','活动优惠券'],
				finish:['编辑活动','邀请员工','活动业绩'],
				pageSize:10,
				actList:[],
				lastPage:'',
				imgSrc:[],
				height:0,
				avatar:'',
				nickname:'',
				active_status:'',
				operate_status:'',
				page:1,
				store_id:"",
				userinfo:{},//用户信息
				customer_info:''//1会员 2队长
			}
		},
		onLoad(option) {
			console.log(option)
			let store_id = parseInt(option.store_id,10);
			if(!store_id>0){
				store_id = uni.getStorageSync('store_id')
			}else{
				uni.setStorageSync('store_id', store_id)
			}
			this.store_id = store_id
			this.$store.commit('updateStoreId',store_id)
			this.height = parseInt(uni.getSystemInfoSync().windowHeight) - this.height
			this.topNavActiveIndex = parseInt(option.topNavActiveIndex,10)
			if(this.topNavActiveIndex == '2'){
				this.operate_status = 0
				this.active_status = ''
			}
			console.log(this.topNavActiveIndex,'this.topNavActiveIndex')
		},
		onShow() {
			uni.removeStorageSync('editActAdd')
			this.getActList()
			// this.sharePatriarch()
		},
		onUnload() {
			this.$store.state.actForm=null
		},
		methods:{
			// 跳转至我的专属活动收款码
			codeClick(item){
				uni.navigateTo({
					url:"../collectioncode/collectioncode/collectioncode?&store_id=" + this.store_id + '&activity_id=' + item.activity_id +'&customer_id='+ this.userinfo.customer_id
				})
			},
			baoming_codeClick(item){
				uni.navigateTo({
					url:"../collectioncode/collectioncode/baoming_collectioncode?&store_id=" + this.store_id + '&activity_id=' + item.activity_id +'&customer_id='+ this.userinfo.customer_id
				})
			},
			getCustomer(){
				
				const data = {
					token:this.token,
					store_id:this.store_id
				}
				this.$api.getCustomerInfo(data).then(res => {
					console.log(res)
					if(res.status){
						this.customer_info = res.data.role
						this.userinfo=res.data.userinfo
						console.log(this.customer_info,'当前用户信息')
					}
				}).catch(err => {
					console.log(err)
				})
				// let customer_info = this.$api.getCustomerInfo(data)
				// console.log(this.customer_info)
				
			},
			shareClick(item){
				console.log("shareClick",'/pages/home/organization/activeDetail-3?store_id=' + this.store_id + '&page=details&actId=' + item.activity_id)
				uni.navigateTo({
					url:'/pages/home/organization/activeDetail-3?store_id=' + this.store_id + '&page=details&actId=' + item.activity_id
				})
			},
			unbeginClick(item){
				console.log("unbeginClick")
				if(item.active_type == 'qrcode'){
					uni.setStorageSync('editAct',item)
					this.$store.state.actForm=null
					console.log("../collectioncode/collectioncode/modifyCollectioncode?page=edit&id=" + item.activity_id + "&store_id=" + this.store_id)
					uni.navigateTo({
						url:"../collectioncode/collectioncode/modifyCollectioncode?page=edit&id=" + item.activity_id + "&store_id=" + this.store_id
					})
				}else{
					uni.setStorageSync('editAct',item)
					this.$store.state.actForm=null
					console.log('../specialGroup/specialGroup?page=edit&id=' + item.activity_id + '&store_id=' + this.store_id)
					uni.navigateTo({
						url:'../specialGroup/specialGroup?page=edit&id=' + item.activity_id + '&store_id=' + this.store_id
					})
				}
			},
			codeUnbeginClick(item){
				console.log("codeUnbeginClick")
				uni.setStorageSync('editAct',item)
				this.$store.state.actForm=null
				console.log("../collectioncode/collectioncode/modifyCollectioncode?page=edit&id=" + item.activity_id + "&store_id=" + this.store_id)
				// uni.navigateTo({
				// 	url:"../collectioncode/collectioncode/modifyCollectioncode?page=edit&id=" + item.activity_id + "&store_id=" + this.store_id
				// })
			},
			finishClick(index,item){
				console.log("finishClick")
				if(index == 0){
					if(this.customer_info == 1){
						uni.showToast({
							title:'您暂无修改活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}else if(this.customer_info == 2){
						let data = {
							token:this.$store.getters.getToken,
							// activity_id:85
							activity_id:item.activity_id
						}
						this.$api.judge_add_act(data).then(res => {
							console.log(res)
							if(!res.status){
								uni.showToast({
									title:'您暂无修改此活动的权限',
									icon:'none',
									duration:2000
								})
								return false
							}
						}).catch(err => {
							console.log(err)
						})
					}
					uni.setStorageSync('editAct',item)
					this.$store.state.actForm=null
					uni.navigateTo({
						url:'../specialGroup/specialGroup?page=edit&id=' + item.activity_id + '&store_id=' + this.store_id
					})
				}else if(index == 1){
					console.log(item,'finishClick');
					
					if(this.customer_info == 1 || this.customer_info == 2){
						uni.showToast({
							title:'您暂无修改活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}
					uni.setStorageSync('inviteStaffAct',item)
					uni.navigateTo({
						url:'../formGatherManage/inviteStaffManage/inviteStaffManage?page=actManage&use=inviteAct&store_id=' + this.store_id
					})
				}else if(index == 2){
					if(this.customer_info == 1 || this.customer_info == 2){
						uni.showToast({
							title:'您暂无修改活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}
					uni.setStorageSync('actPerfor',item)
					uni.navigateTo({
						url:'../shopPerformance/actPerforAll/actPerforAll?store_id=' + this.store_id
					})
				}
			},
			codeFinishClick(index,item){
				console.log("unpublishedClick")
				if(index == 0){
					if(this.customer_info == 1){
						uni.showToast({
							title:'您暂无修改活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}else if(this.customer_info == 2){
						let data = {
							token:this.$store.getters.getToken,
							// activity_id:85
							activity_id:item.activity_id
						}
						this.$api.judge_add_act(data).then(res => {
							console.log(res)
							if(!res.status){
								uni.showToast({
									title:'您暂无修改此活动的权限',
									icon:'none',
									duration:2000
								})
								return false
							}
						}).catch(err => {
							console.log(err)
						})
					}
					uni.setStorageSync('editAct',item)
					this.$store.state.actForm=null
					uni.navigateTo({
						url:"../collectioncode/collectioncode/modifyCollectioncode?page=edit&id=" + item.activity_id + "&store_id=" + this.store_id
					})
				}else if(index == 1){
					console.log(item,'finishClick');
					
					if(this.customer_info == 1 || this.customer_info == 2){
						uni.showToast({
							title:'您暂无修改活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}
					uni.setStorageSync('inviteStaffAct',item)
					uni.navigateTo({
						url:'../formGatherManage/inviteStaffManage/inviteStaffManage?page=actManage&use=inviteAct&store_id=' + this.store_id
					})
				}else if(index == 2){
					if(this.customer_info == 1 || this.customer_info == 2){
						uni.showToast({
							title:'您暂无修改活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}
					uni.setStorageSync('actPerfor',item)
					uni.navigateTo({
						url:'../shopPerformance/actPerforAll/actPerforAll?store_id=' + this.store_id
					})
				}
			},
			unpublishedClick(index,item){
				console.log("unpublishedClick")
				if(index == 0){
					if(this.customer_info == 1){
						uni.showToast({
							title:'您暂无修改活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}else if(this.customer_info == 2){
						let data = {
							token:this.$store.getters.getToken,
							// activity_id:85
							activity_id:item.activity_id
						}
						this.$api.judge_add_act(data).then(res => {
							console.log(res)
							if(!res.status){
								uni.showToast({
									title:'您暂无修改此活动的权限',
									icon:'none',
									duration:2000
								})
								return false
							}
						}).catch(err => {
							console.log(err)
						})
					}
					uni.setStorageSync('editAct',item)
					this.$store.state.actForm=null
					uni.navigateTo({
						url:'../specialGroup/specialGroup?page=edit&id=' + item.activity_id + '&store_id=' + this.store_id
					})
				}else if(index == 1){
					console.log(item,'123123123123123123123123123123123');
					if(this.customer_info == 1 || this.customer_info == 2){
						uni.showToast({
							title:'您暂无修改活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}
					uni.setStorageSync('inviteStaffAct',item)
					uni.navigateTo({
						url:'../formGatherManage/inviteStaffManage/inviteStaffManage?page=actManage&use=inviteAct&store_id=' + this.store_id
					})
				}else if(index == 2){
					uni.navigateTo({
						url: 'exclusiveCoupon/exclusiveCoupon?actId=' + item.activity_id + '&store_id=' + this.store_id
					})
				}
			},
			codeUnpublishedClick(index,item){
				console.log("codeUnpublishedClick")
				if(index == 0){
					if(this.customer_info == 1){
						uni.showToast({
							title:'您暂无修改活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}else if(this.customer_info == 2){
						let data = {
							token:this.$store.getters.getToken,
							// activity_id:85
							activity_id:item.activity_id
						}
						this.$api.judge_add_act(data).then(res => {
							console.log(res)
							if(!res.status){
								uni.showToast({
									title:'您暂无修改此活动的权限',
									icon:'none',
									duration:2000
								})
								return false
							}
						}).catch(err => {
							console.log(err)
						})
					}
					uni.setStorageSync('editAct',item)
					this.$store.state.actForm=null
					uni.navigateTo({
						url:"../collectioncode/collectioncode/modifyCollectioncode?page=edit&id=" + item.activity_id + "&store_id=" + this.store_id
					})
				}else if(index == 1){
					console.log(item,'123123123123123123123123123123123');
					if(this.customer_info == 1 || this.customer_info == 2){
						uni.showToast({
							title:'您暂无修改活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}
					uni.setStorageSync('inviteStaffAct',item)
					uni.navigateTo({
						url:'../formGatherManage/inviteStaffManage/inviteStaffManage?page=actManage&use=inviteAct&store_id=' + this.store_id
					})
				}else if(index == 2){
					uni.navigateTo({
						url: 'exclusiveCoupon/exclusiveCoupon?actId=' + item.activity_id + '&store_id=' + this.store_id
					})
				}
			},
			topNavCk(index) {
				this.topNavActiveIndex = index
				this.getActList()
			},
			addForm(){
				uni.navigateTo({
					url:'./addForm/addFormDetails?store_id='  +this.store_id
				})
			},
			operateClick(index,item){
				console.log("operateClick")
				console.log(this.customer_info)
				if(index == 0){//编辑活动
					if(this.customer_info == 1){
						uni.showToast({
							title:'您暂无修改活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}else if(this.customer_info == 2){
						let data = {
							token:this.$store.getters.getToken,
							// activity_id:85
							activity_id:item.activity_id
						}
						this.$api.judge_add_act(data).then(res => {
							console.log(res)
							if(!res.status){
								uni.showToast({
									title:'您暂无修改此活动的权限',
									icon:'none',
									duration:2000
								})
								return false
							}
							uni.setStorageSync('editAct',item)
							this.$store.state.actForm=null
							uni.navigateTo({
								url: '../specialGroup/specialGroup?page=edit&id=' + item.activity_id + '&store_id=' + this.store_id
							})
						}).catch(err => {
							console.log(err)
						})
					}else{
						uni.setStorageSync('editAct',item)
						this.$store.state.actForm=null
						uni.navigateTo({
							url: '../specialGroup/specialGroup?page=edit&id=' + item.activity_id + '&store_id=' + this.store_id
						})
					}
					
				}else if(index == 1){//邀请员工
					console.log(item,'operateClick');
					console.log(this.customer_info,'this.customer_info');
					if(this.customer_info == 1 ){
						uni.showToast({
							title:'您暂无邀请员工的权限',
							icon:'none',
							duration:2000
						})
						return false
					}else if(this.customer_info == 2){
						let data = {
							token:this.$store.getters.getToken,
							// activity_id:85
							activity_id:item.activity_id
						}
						this.$api.judge_add_act(data).then(res => {
							console.log(res)
							if(!res.status){
								uni.showToast({
									title:'您暂无修改此活动的权限',
									icon:'none',
									duration:2000
								})
								return false
							}
							uni.setStorageSync('inviteStaffAct',item);
							uni.navigateTo({
								url:'../formGatherManage/inviteStaffManage/inviteStaffManage?page=actManage&use=inviteAct&store_id=' + this.store_id,
								success:function(res){
									console.log(res,'uni.navigateTo success');
								},
								fail:function(res){
									console.log(res,'uni.navigateTo fail');
								}
							})
						}).catch(err => {
							console.log(err)
						})
					}else{
						uni.setStorageSync('inviteStaffAct',item);
						uni.navigateTo({
							url:'../formGatherManage/inviteStaffManage/inviteStaffManage?page=actManage&use=inviteAct&store_id=' + this.store_id,
							success:function(res){
								console.log(res,'uni.navigateTo success');
							},
							fail:function(res){
								console.log(res,'uni.navigateTo fail');
							}
						})
					}
					
				}else if(index == 2){//活动业绩
					if(this.customer_info == 1){
						uni.showToast({
							title:'您暂无查看活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}else if(this.customer_info == 2){
						let data = {
							token:this.$store.getters.getToken,
							// activity_id:85
							activity_id:item.activity_id
						}
						this.$api.judge_add_act(data).then(res => {
							console.log(res)
							if(!res.status){
								uni.showToast({
									title:'您暂无修改此活动的权限',
									icon:'none',
									duration:2000
								})
								return false
							}
							uni.setStorageSync('actPerfor',item)
							uni.navigateTo({
								url:'../shopPerformance/actPerforAll/actPerforAll?store_id=' + this.store_id + '&page=manage'
							})
						}).catch(err => {
							console.log(err)
						})
					}else{
						
						uni.setStorageSync('actPerfor',item)
						uni.navigateTo({
							url:'../shopPerformance/actPerforAll/actPerforAll?store_id=' + this.store_id + '&page=manage'
						})
					}
				}else if(index == 3){//订单详情
					uni.setStorageSync('actPerfor',item)
					if(item.group_purchase.length!=0){
						uni.navigateTo({
							url: '../shopPerformance/groupDetails/groupDetails?store_id=' + this.store_id 
						})
					}else{
						uni.navigateTo({
							url:'../shopPerformance/discountsDetails/discountsDetails?store_id=' + this.store_id
						})
					}
				}else if(index == 4){//活动优惠券
					uni.setStorageSync('actPerfor',item)
					uni.navigateTo({
						url: 'exclusiveCoupon/exclusiveCoupon?store_id=' + this.store_id
					})
				}else if(index == 5){//结束活动
					if(this.customer_info == 1){
						uni.showToast({
							title:'您暂无结束活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}else if(this.customer_info == 2){
						let data = {
							token:this.$store.getters.getToken,
							// activity_id:85
							activity_id:item.activity_id
						}
						this.$api.judge_add_act(data).then(res => {
							console.log(res)
							if(!res.status){
								uni.showToast({
									title:'您暂无修改此活动的权限',
									icon:'none',
									duration:2000
								})
								return false
							}							
							let data = {
								token:this.$store.getters.getToken,
								activity_id:item.activity_id,
								active_status:2
							}
							this.$api.finish_act(data).then(res => {
								console.log(res)
								if(res.status){
									uni.showToast({
										title:res.msg,
										icon:'none',
										duration:2000
									})
									setTimeout(() => {
										this.getActList()
									},1000)
								}
							}).catch(err => {
								console.log(err)
							})
						}).catch(err => {
							console.log(err)
						})
					}else{
						let data = {
							token:this.$store.getters.getToken,
							activity_id:item.activity_id,
							active_status:2
						}
						this.$api.finish_act(data).then(res => {
							console.log(res)
							if(res.status){
								uni.showToast({
									title:res.msg,
									icon:'none',
									duration:2000
								})
								setTimeout(() => {
									this.getActList()
								},1000)
							}
						}).catch(err => {
							console.log(err)
						})
					}
				}
			},
			codeOperateClick(index,item){
				console.log("codeOperateClick")
				console.log(this.customer_info)
				if(index == 0){//编辑活动
					if(this.customer_info == 1){
						uni.showToast({
							title:'您暂无修改活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}else if(this.customer_info == 2){
						let data = {
							token:this.$store.getters.getToken,
							// activity_id:85
							activity_id:item.activity_id
						}
						this.$api.judge_add_act(data).then(res => {
							console.log(res)
							if(!res.status){
								uni.showToast({
									title:'您暂无修改此活动的权限',
									icon:'none',
									duration:2000
								})
								return false
							}
							uni.setStorageSync('editAct',item)
							this.$store.state.actForm=null
							console.log("../collectioncode/collectioncode/modifyCollectioncode?page=edit&id=" + item.activity_id + "&store_id=" + this.store_id)
							uni.navigateTo({
								url:"../collectioncode/collectioncode/modifyCollectioncode?page=edit&id=" + item.activity_id + "&store_id=" + this.store_id
							})
						}).catch(err => {
							console.log(err)
						})
					}else{
						uni.setStorageSync('editAct',item)
						this.$store.state.actForm=null
						console.log("../collectioncode/collectioncode/modifyCollectioncode?page=edit&id=" + item.activity_id + "&store_id=" + this.store_id)
						uni.navigateTo({
							url:"../collectioncode/collectioncode/modifyCollectioncode?page=edit&id=" + item.activity_id + "&store_id=" + this.store_id
						})
					}
					
				}else if(index == 1){//邀请员工
					console.log(item,'codeOperateClick');
					console.log(this.customer_info,'this.customer_info');
					if(this.customer_info == 1 ){
						uni.showToast({
							title:'您暂无邀请员工的权限',
							icon:'none',
							duration:2000
						})
						return false
					}else if(this.customer_info == 2){
						let data = {
							token:this.$store.getters.getToken,
							// activity_id:85
							activity_id:item.activity_id
						}
						this.$api.judge_add_act(data).then(res => {
							console.log(res)
							if(!res.status){
								uni.showToast({
									title:'您暂无修改此活动的权限',
									icon:'none',
									duration:2000
								})
								return false
							}
							uni.setStorageSync('inviteStaffAct',item);
							uni.navigateTo({
								url:'../formGatherManage/inviteStaffManage/inviteStaffManage?page=actManage&use=inviteAct&store_id=' + this.store_id,
								success:function(res){
									console.log(res,'uni.navigateTo success');
								},
								fail:function(res){
									console.log(res,'uni.navigateTo fail');
								}
							})
						}).catch(err => {
							console.log(err)
						})
					}else{
						uni.setStorageSync('inviteStaffAct',item);
						uni.navigateTo({
							url:'../formGatherManage/inviteStaffManage/inviteStaffManage?page=actManage&use=inviteAct&store_id=' + this.store_id,
							success:function(res){
								console.log(res,'uni.navigateTo success');
							},
							fail:function(res){
								console.log(res,'uni.navigateTo fail');
							}
						})
					}
					
				}else if(index == 2){//活动业绩
					if(this.customer_info == 1){
						uni.showToast({
							title:'您暂无查看活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}else if(this.customer_info == 2){
						let data = {
							token:this.$store.getters.getToken,
							// activity_id:85
							activity_id:item.activity_id
						}
						this.$api.judge_add_act(data).then(res => {
							console.log(res)
							if(!res.status){
								uni.showToast({
									title:'您暂无修改此活动的权限',
									icon:'none',
									duration:2000
								})
								return false
							}
							uni.setStorageSync('actPerfor',item)
							uni.navigateTo({
								url:'../shopPerformance/actPerforAll/actPerforAll?store_id=' + this.store_id + '&page=manage'
							})
						}).catch(err => {
							console.log(err)
						})
					}else{
						
						uni.setStorageSync('actPerfor',item)
						uni.navigateTo({
							url:'../shopPerformance/actPerforAll/actPerforAll?store_id=' + this.store_id + '&page=manage'
						})
					}
				}else if(index == 3){//订单详情
					uni.setStorageSync('actPerfor',item)
					if(item.group_purchase.length!=0){
						uni.navigateTo({
							url: '../shopPerformance/groupDetails/groupDetails?store_id=' + this.store_id 
						})
					}else{
						uni.navigateTo({
							url:'../shopPerformance/discountsDetails/discountsDetails?store_id=' + this.store_id
						})
					}
				}else if(index == 4){//结束活动
					if(this.customer_info == 1){
						uni.showToast({
							title:'您暂无结束活动的权限',
							icon:'none',
							duration:2000
						})
						return false
					}else if(this.customer_info == 2){
						let data = {
							token:this.$store.getters.getToken,
							// activity_id:85
							activity_id:item.activity_id
						}
						this.$api.judge_add_act(data).then(res => {
							console.log(res)
							if(!res.status){
								uni.showToast({
									title:'您暂无修改此活动的权限',
									icon:'none',
									duration:2000
								})
								return false
							}							
							let data = {
								token:this.$store.getters.getToken,
								activity_id:item.activity_id,
								active_status:2
							}
							this.$api.finish_act(data).then(res => {
								console.log(res)
								if(res.status){
									uni.showToast({
										title:res.msg,
										icon:'none',
										duration:2000
									})
									setTimeout(() => {
										this.getActList()
									},1000)
								}
							}).catch(err => {
								console.log(err)
							})
						}).catch(err => {
							console.log(err)
						})
					}else{
						let data = {
							token:this.$store.getters.getToken,
							activity_id:item.activity_id,
							active_status:2
						}
						this.$api.finish_act(data).then(res => {
							console.log(res)
							if(res.status){
								uni.showToast({
									title:res.msg,
									icon:'none',
									duration:2000
								})
								setTimeout(() => {
									this.getActList()
								},1000)
							}
						}).catch(err => {
							console.log(err)
						})
					}
				}
			},
			checkMsg(item){
				uni.setStorageSync('actPerfor',item)
				if(item.group_purchase.length!=0){
					uni.navigateTo({
						url: '../shopPerformance/groupDetails/groupDetails?store_id=' + this.store_id 
					})
				}else{
					uni.navigateTo({
						url:'../shopPerformance/discountsDetails/discountsDetails?store_id=' + this.store_id
					})
				}
				// uni.setStorageSync('finishActOrder',item)
				// uni.navigateTo({
				// 	// url:'../formGatherManage/inviteStaffManage/inviteStaffManage?page=actManage&use=checkAct&store_id=' + this.store_id
				// })
			},
			// 获取所有活动信息
			getActList(){
				switch(this.topNavActiveIndex){
					case 1:
						this.active_status = 1
						this.operate_status = 1
						break;
					case 3:
						this.active_status = 2
						this.operate_status = 1
						break;
					case 2:
						this.operate_status = 0
						this.active_status = ''
						break;
					case 0:
						this.active_status = ''
						this.operate_status = ''
						break;
				}
				let data = {
					toekn:this.$store.getters.getToken,
					page:1,
					pagesize:this.pageSize,
					store_id:this.$store.getters.getStoreId,
					operate_status:this.operate_status,
					active_status:this.active_status
				}
				this.$api.gain_act_manange(data).then(res => {
					console.log(res)
					if(res.status){
						this.actList = res.list.data
						this.lastPage = res.list.last_page
						this.getCustomer()
						console.log(this.actList)
						// for(let i=0; i<this.actList.length; i++){
						// 	this.avatar = this.actList[i].customer[0].avatar
						// 	this.nickname = this.actList[i].customer[0].nickname
						// }
						
					}else{
						uni.showToast({
							title:res.msg,
							icon:"none",
							duration:2000
						})
					}
				}).catch(err => {
					console.log(err)
				})
			},
			// 加载下一页
			LoadingMore(){
				this.page ++
				if(this.page <= this.lastPage){
					let data = {
						page:this.page,
						pagesize:this.pageSize,
						store_id:this.$store.getters.getStoreId,
						operate_status:this.operate_status,
						active_status:this.active_status
					}
					this.$api.gain_act_manange(data).then(res => {
						console.log(res)
						if(res.status){
							this.actList = this.actList.concat(res.list.data)
							console.log('第多少页',this.page,this.actList.length)
							for(let i=0; i<this.actList.length; i++){
								this.imgSrc.push(this.actList[i].all_image[0].image) 
								this.avatar = this.actList[i].customer[0].avatar
								this.nickname = this.actList[i].customer[0].nickname
							}
							
						}else{
							uni.showToast({
								title:res.msg,
								icon:"none",
								duration:2000
							})
						}
					}).catch(err => {
						console.log(err)
					})
				}else{
					uni.showToast({
						title:'没有更多了！',
						icon:'none',
						duration:2000
					})
				}
			}
		}
	}
</script>

<style scoped>
	.popup_box_de_share{
		width: 100%;
		height: 100%;
	}
	.popup_box_close_share{
		width: 300upx;
		height: 300upx;
		position: fixed;
		top: 10upx;right: 10upx;
	}
	.no-act{
		color: #999999;
		font-size: 28upx;
		position: fixed;
		left: 50%;top: 50%;
		transform: translate(-50%,-50%);
	}
	page{
		background: #F3F3F4;
	}
	.form-gather-page{
		width: 100%;
		height: 100%;
	}
	.top_nav{
		width: 100%;
		height: 88upx;
		line-height: 88upx;
		background-color: #fff;
		margin-bottom: 10upx;
		box-sizing: border-box;
		color:#666666;
		display: flex;
		padding: 0upx 30upx;
		justify-content: space-between;
		font-size: 30upx;
		/* position: fixed;
		top: 0;left: 0;
		z-index: 999; */
	}
	.top_nav>view{
		width: 160upx;
		text-align: center;
	}
	.top_nav_active {
		color: #FF8B46;
		position: relative;
	}
	.top_nav_active::after {
		position: absolute;
		content: '';
		width: 72upx;
		height: 6upx;
		background-color: #FF8B46;
		border-radius: 3upx;
		bottom: 0upx;
		left: 50%;
		transform: translate(-50%,0);
	}
	.act-content{
		width: 100%;
		padding: 30upx;
		box-sizing: border-box;
		margin-bottom: 20upx;
		background: #FFFFFF;
	}
	.code-act-content{
		width: 100%;
		padding: 30upx;
		box-sizing: border-box;
		margin-bottom: 20upx;
		background: #FFFFFF;
	}
	.act-content-detail{
		width: 100%;
		position: relative;
	}
	.act-content-detail>image{
		width: 100%;
	}
	.group-join{
		width: 138upx;
		height: 60upx;
		color: #FFFFFF;
		text-align: center;
		line-height: 60upx;
		background: url(https://tool.tuanhaoke.cn/static/image/home/home_image_back.png) no-repeat;
		background-size: 100% 100%;
		font-size: 28upx;
		position: absolute;
		top: -4upx;left: -16upx;
	}
	.act-content-group{
		width: 140upx;
		height: 60upx;
		line-height: 60upx;
		text-align: center;
		color: #FFFFFF;
		font-size: 28upx;
		background: url(https://tool.tuanhaoke.cn/static/image/home/home_image_back.png) no-repeat;
		position: absolute;
		background-size: 100% 100%;
		top: -4upx;left: -16upx;
	}
	.activity-collection-code{
		width: 185upx;
		height: 56upx;
		line-height: 53upx;
		text-align: center;
		color: #FFFFFF;
		font-size: 28upx;
		background: url(https://tool.tuanhaoke.cn/static/image/member/activity-collection-code.png) no-repeat;
		position: absolute;
		background-size: 100% 100%;
		top: 32upx;
	}
	/* .underway{
		width: 124upx;
		height: 48upx;
		line-height: 48upx;
		border-radius: 84upx 0 0 84upx;
		background: #68CB00;
		text-align: center;
		color: #FFFFFF;
		font-size: 28upx;
		position: absolute;
		top: 0;right: 0;
	} */
	.underway{
		width: 132upx;
		height: 56upx;
		line-height: 48upx;
		border-radius: 84upx 0 0 84upx;
		background: #F86363;
		text-align: center;
		color: #FFFFFF;
		font-size: 28upx;
		position: absolute;
		top: 32upx;
		right: 0;
	}
	/* .unbegin{
		width: 124upx;
		height: 48upx;
		line-height: 48upx;
		border-radius: 84upx 0 0 84upx;
		background: rgba(0,0,0,0.3);
		text-align: center;
		color: #FFFFFF;
		font-size: 28upx;
		position: absolute;
		top: 0;right: 0;
	} */
	.unbegin{
		width: 132upx;
		height: 56upx;
		line-height: 48upx;
		border-radius: 84upx 0 0 84upx;
		background: rgba(0,0,0,0.3);
		text-align: center;
		color: #FFFFFF;
		font-size: 28upx;
		position: absolute;
		top: 32upx;right: 0;
	}
	.act-title-content{
		width: 100%;
		padding: 30upx 0;
		box-sizing: border-box;
		position: relative;
		border-bottom: 1upx solid #DEDEDE;
	}
	.code-act-title-content{
		width: 100%;
		padding: 30upx 0;
		margin-bottom: 30upx;
		box-sizing: border-box;
		position: relative;
		border-bottom: 1upx solid #DEDEDE;
	}
	.act-title-detail{
		display: flex;
	}
	.act-title-detail>text:nth-child(1){
		color: #999999;
		font-size: 24upx;
		line-height: 40upx;
	}
	.act-name{
		color:#000000;
		font-size: 24upx;
		line-height: 40upx;
	}
	.act-title-detail>image{
		width: 40upx;
		height: 40upx;
		margin: 0 10upx;
		border-radius: 50%;
	}
	.share-patriarch{
		width: 160upx;
		height: 40upx;
		line-height: 40upx;
		text-align: center;
		color: #FFFFFF;
		font-size: 24upx;
		background: linear-gradient(to right,#FE9543,#FF664F);
		box-shadow: 0 4upx 12upx 0 rgba(255, 95, 63, 0.47);
		border-radius: 30upx;
		position: absolute;
		bottom: 20upx;right: 0;
	}
	.code-share-patriarch{
		width: 242upx;
		height: 52upx;
		line-height: 50upx;
		text-align: center;
		color: #FFFFFF;
		font-size: 26upx;
		background: linear-gradient(to right,#FE9543,#FF664F);
		box-shadow: 0 4upx 12upx 0 rgba(255, 95, 63, 0.47);
		border-radius: 30upx;
		position: absolute;
		bottom: 30upx;right: 0;
	}
	.code-share-patriarch2{
		/* color: #000000; */
		bottom: 90upx;right: 0;
		/* background: #FFFFFF; */
		/* box-shadow: none; */
		/* border: 1upx #8E8E8E solid; */
	}
	.act-operate{
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
	}
	.code-act-operate{
		display: flex;
		flex-wrap: wrap;
	}
	.act-operate>view{
		width: 180upx;
		height: 60upx;
		text-align: center;
		line-height: 60upx;
		font-size: 24upx;
		color: #666666;
		background: #F3F3F4;
		border-radius: 30upx;
		margin-top: 30upx;
	}
	.code-act-operate>view{
		width: 192upx;
		height: 60upx;
		margin: 0 19upx;
		text-align: center;
		line-height: 60upx;
		font-size: 24upx;
		color: #666666;
		background: #F3F3F4;
		border-radius: 30upx;
		margin-top: 30upx;
	}
	.act-title-details{
		color: #333333;
		font-size: 34upx;
		margin-top: 20upx;
	}
	.code-act-title-details{
		color: #333333;
		font-size: 34upx;
		margin-top: 20upx;
	}
	.order-detail{
		width: 100%;
		height: 60upx;
		line-height: 60upx;
		text-align: center;
		color: #666666;
		font-size: 28upx;
		background: #F3F3F4;
		border-radius: 30upx;
		margin-top: 30upx;
	}
	/* .unpublished{
		background: #FF391F;
		width: 124upx;
		height: 48upx;
		line-height: 48upx;
		border-radius: 84upx 0 0 84upx;
		text-align: center;
		color: #FFFFFF;
		font-size: 28upx;
		position: absolute;
		top: 0;right: 0;
	} */
	.unpublished{
		background: #FF391F;
		width: 132upx;
		height: 56upx;
		line-height: 48upx;
		border-radius: 84upx 0 0 84upx;
		text-align: center;
		color: #FFFFFF;
		font-size: 28upx;
		position: absolute;
		top: 32upx;right: 0;
	}
	/* .finished{
		color: #999999;
		background: #F3F3F4;
		width: 124upx;
		height: 48upx;
		line-height: 48upx;
		border-radius: 84upx 0 0 84upx;
		text-align: center;
		font-size: 28upx;
		position: absolute;
		top: 0;right: 0;
	} */
	.finished{
		color: #999999;
		background: #F3F3F4;
		width: 132upx;
		height: 56upx;
		line-height: 55upx;
		border-radius: 84upx 0 0 84upx;
		text-align: center;
		font-size: 28upx;
		position: absolute;
		top: 32upx;right: 0;
	}
	.add-form{
		width: 100%;
		height: 100upx;
		background: #FFFFFF;
		position: fixed;
		bottom: 0;left: 0;
	}
	.add-form>view{
		width: 638upx;
		height: 80upx;
		line-height: 80upx;
		text-align: center;
		color: #FFFFFF;
		font-size: 28upx;
		margin: 0 auto;
		margin-top: 10upx;
		background: linear-gradient(to right,#FE9543,#FF664F);
		border-radius: 44upx ;
		box-shadow: 0 4upx 12upx 0 #8CFAB030;
	}
</style>
